home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / comm / bbs / WWBBSDoors.lha / WWBBS / rexxDoors / BlackJack.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-04-27  |  29.8 KB  |  1,183 lines

  1. /*                     Black Jack Version 2.0
  2.  This game is written specially to run on BBBBS, the BBS software
  3.  package written by Richard Stockton. This game was written by
  4.  Matt English on 5-7-92. You have my premission to use this game
  5.  on your BBS as long as you leave my name in the code as original writer
  6.  and you don't make any cash from this game (in any way).
  7.  This is version 1.0. I have other ideas for this game that I will put in
  8.  future versions (if I get the time). To run the game, just put this file
  9.  in your Rexxdoors directory. Hope you like it.
  10.  
  11.                               6-21-92
  12.  Version 2.0 now includes the ability to play from INSIDE of Chicago 1.3!
  13.  Version 2.0 wil also run fine by itself, without Chicago 1.3, but it's
  14.  more fun that way!*/
  15.  
  16. options results
  17.  
  18. FF='0C'x  /* FormFeed */
  19. CR='0D'x  /* Carraige Return */
  20. CALL TIME('R')
  21. SIGNAL ON BREAK_C
  22. SIGNAL ON BREAK_E
  23.  
  24. PARSE arg Username winnings . colorflag secs .
  25. IF secs='' THEN secs=3600
  26. signal on syntax
  27.  
  28. BBSIDENTIFY EMULATION
  29. PARSE VAR RESULT type .
  30. if type = "ANSI" then
  31.   colorflag=1
  32. else
  33.   colorflag=0
  34.  
  35. BBSIDENTIFY USER
  36. PARSE VAR RESULT Username From Acces .
  37. Username = substr(Username,2,length(Username)-2)
  38.  
  39. if ~show('L','rexxsupport.library') then do
  40.   addlib('rexxsupport.library',0,-30,0)
  41.   end
  42.  
  43. i = random(1,999,time('S')) /* initalize random number generator */
  44.  
  45.  
  46. def=''
  47. pen2=''
  48. pen3=''
  49. pen4=''
  50. pen5=''
  51. pen6=''
  52. pen7=''
  53. bak2=''
  54. bak3=''
  55. bak4=''
  56. bak5=''
  57. bak6=''
  58. bak7=''
  59. unln=''
  60. CLS = ''
  61.  
  62. CHICCOLOR = GetClip('CHICCOLOR')
  63.  
  64. IF colorflag=1 | CHICCOLOR = 1 THEN
  65.   DO
  66.     def=''
  67.     pen2=''
  68.     pen3=''
  69.     pen4=''
  70.     pen5=''
  71.     pen6=''
  72.     pen7=''
  73.     bak2=''
  74.     bak3=''
  75.     bak4=''
  76.     bak5=''
  77.     bak6=''
  78.     bak7=''
  79.     unln=''
  80.   END
  81.   CLS = ''
  82.  
  83. /*This checks to see if the game has been called from Chicago 1.3
  84. and makes the proper adjustments.*/
  85.  
  86. chicplay = GetClip('CHICMON')
  87. if chicplay ~='' then do
  88.    avc = chicplay
  89.    chicgame = 1
  90.    secs=360  /* 6 minute limit from Chicago */
  91.    call play
  92.    end
  93.  
  94. /*-----------------MAIN SECTION----------------------*/
  95.  
  96. START:
  97. avc = 500
  98. say ''cls''cr
  99. say ''cr
  100. call header
  101. say ''cr
  102. call sac70'Welcome to BlackJack!'
  103. say ''cr
  104. call sac70'Version 2.0  6-21-92'
  105. say ''cr
  106. call sac70'Written by Matt English'
  107. say ''cr
  108. call sac70'SYSOP - The Alternative BBS - Portland Oregon'
  109. call sac70'503-761-3043'
  110. say ''cr
  111. say ''cr
  112. say ''cr
  113. say ''cr
  114. say ''cr
  115. call pressreturn
  116. say ''cr
  117.  
  118. Play:
  119.     CALL checkBBS()
  120.     cc = 0
  121.     dc = 0
  122.     h1.1='';h1.2='';h1.3='';h1.4='';h1.5='';h1.6='';h1.7='';h1.8='' /* Player hand 1 */
  123.     h2.1='';h2.2='';h2.3='';h2.4='';h2.5='';h2.6='';h2.7='';h2.8=''/* Player hand 2 */
  124.     d.1='';d.2='';d.3='';d.4='';d.5='';d.6='';d.7='';d.8=''       /*Dealer hand */
  125.     say ''cr
  126.     if avc < 1 then do
  127.      call sac70'Your available funds seem to have dropped below the minimum bet!'
  128.      say ''cr
  129.      prompt('       Would you like to play again? (y,n) >')
  130.      answer=readstr()
  131.       if answer = Y then do
  132.        avc = 500
  133.        say ''cr
  134.        call sac70'OK, let''s try it again!'
  135.        say ''cr
  136.        end
  137.       else call QUIT
  138.      end
  139.   /*  prompt(' How much would you like to bet? (Q = Quit) >')
  140.     choice=readstr()
  141.     choice = strip(choice)   */
  142.  
  143.    call bet
  144.  
  145.    avc = (avc - abet)
  146.     say ''cr
  147.     say ''cr
  148.     ptot1 = 0    /* Player total card points hand 1 */
  149.     ptot2 = 0    /* Player total card points hand 2 */
  150.     dtot = 0    /* Dealer total card points */
  151.     busted = 0
  152.     busted1 = 0
  153.     busted2 = 0
  154.     dlbusted = 0
  155.     twone = 0
  156.     twone1 = 0
  157.     twone2 = 0
  158.     bj1 = 0
  159.     bj2 = 0
  160.     acecount = 0
  161.     call Play1
  162.  
  163. PLAY1:
  164.  
  165.   say ''cr
  166.   say ''cr
  167.   do i = 1 to 2
  168.     call getcard
  169.     h1.i = RCD
  170.   end
  171.   do i = 1 to 2
  172.     call getcard
  173.     d.i = RCD
  174.   end
  175.   BJ = 0  /* BlackJack if = 1 */
  176.   cc = 2  /* card count */
  177.   dc = 2  /* dealers card count */
  178.   splh = 0    /* This hand is a split hand  if 1 */
  179.   splm = 0   /* display the Split menu  if 1 */
  180.   ddnm = 0   /* Display the DD menu if 1 */
  181.   ddnh = 0    /* This hand is Double Down'ed if 1 */
  182.  
  183.   call play2
  184.  
  185. PLAY2:
  186.   if chicgame ~=1 then call header
  187.   say ''cr
  188.   say ''cr
  189.   say'     Amount bet > $'abet'      Your available cash > $'avc''cr
  190.   say ''cr
  191.  
  192.     say' 'bak6'Your Hand >'def' 'pen6''h1.1' 'h1.2' 'h1.3' 'h1.4' 'h1.5' 'h1.6' 'h1.7' 'h1.8''def''cr
  193.    call CPTOT h1 splh
  194.    say ''cr
  195.    say' 'bak6'Your total >'def' 'pen6''ptot1''def''cr
  196.    say ''cr
  197.  
  198.   say' 'bak2'Dealers Hand >'def''pen2' # 'd.2' 'd.3' 'd.4' 'd.5' 'd.6' 'd.7' 'd.8''def''cr
  199.   say ''cr
  200.   say' 'bak2'Dealers total >'def''pen2' ?'def''cr
  201.   say ''cr
  202.   say ''cr
  203.   if cc = 2 & ptot1 = 21 then call BLACKJACK
  204.   say '             1.Draw a card    (Dealer must stand on 17, hit on 16)'cr
  205.   say '             2.Stand'cr
  206.    if cc = 2 & h1.1 = h1.2 then splm = 1
  207.    else splm = 0
  208.    if splm = 1 then do
  209.    if abet > avc then do
  210.     say '  You don''t have enough cash to Split this hand!'cr
  211.     splm = 0
  212.     end
  213.    else say '             3.Split'cr
  214.    end
  215.   if cc = 2 then call checkdd
  216.   say ''cr
  217.   if chicgame = 1 then quitopt = ''
  218.   else quitopt = '(Q = Quit)'
  219.   prompt( ' Your choice ? 'quitopt' > ')
  220.   ans=readstr()
  221.    select
  222.      when ans = 'Q' then do
  223.       if chicgame ~=1 then call QUIT
  224.       else call PLAY2
  225.       end
  226.      when ans = 1 then do
  227.       h1 = 1
  228.       call DRAW h1 splh
  229.       end
  230.      when ans = 2 then do
  231.       h1 = 1
  232.       call STAND h1 splh
  233.       end
  234.      when ans = 3 then do
  235.       select
  236.        when splm = 1 then call SPLIT
  237.        when splm = 0 & ddnm = 1 then call DDOWN
  238.        otherwise call PLAY2
  239.        end
  240.       end
  241.      when ans = 4 then do
  242.       if splm = 1 & ddnm = 1 then call DDOWN
  243.        else call PLAY2
  244.       end
  245.      otherwise call PLAY2
  246.      end
  247.  
  248. /*---------------------ROUTINES-----------------------*/
  249.  
  250. DDOWN:
  251.    say ''cr
  252.    ddbet = abet + abet
  253.    avc = avc - abet
  254.    abet = ddbet
  255.    call sac70'OK, we''ll double your bet to $'ddbet','
  256.    call sac70'and you''ll get one card.'
  257.    say ''cr
  258.    call sac70'Your available cash is now $'avc''
  259.    call delay(50)
  260.    say ''cr
  261.    call getcard
  262.    h1.3 = rcd
  263.    whatcard = h1
  264.    call cptot whatcard splh
  265.    call sac70'You draw your one card and get'
  266.    say ''cr
  267.    select
  268.     when rcd = A then pre = 'an'
  269.     when rcd = 8 then pre = 'an'
  270.     otherwise pre = 'a'
  271.     end
  272.    call sac70''pre' 'h1.3''
  273.    say ''cr
  274.    say'             'bak6'Your cards :'def' 'pen6''h1.1' 'h1.2' 'h1.3''def'   'bak6'Your total :'def' 'pen6''ptot1''def''cr
  275.    say ''cr
  276.    call pressreturn
  277.    say ''cr
  278.    call sac70'Ok, let''s see if the Dealer can beat that!'
  279.    say ''cr
  280.    call dlrturn
  281.  
  282. SPLIT:
  283.  splh = 1 /* This is a split hand */
  284.  say ''cr
  285.  call sac70'OK, let''s split your 'pen6''h1.1''def'''s into two hands.'
  286.  call sac70''def'You''ll be playing for $'abet' on 'pen3'EACH hand!'def''
  287.  avc = avc - abet
  288.  totwager = abet * 2
  289.  say ''cr
  290.  h1done = 0   /* signals when hand 1 is done and move to hand 2 */
  291.  cch1 = 1
  292.  cch2 = 1
  293.  busted1 = 0
  294.  busted2 = 0
  295.  twone1 = 0
  296.  h1winner = 0
  297.  h2winner = 0
  298.  select
  299.  when h1.1 = 'A' then ptot1 = 11
  300.  when h1.1 = 'K' then ptot1 = 10
  301.  when h1.1 = 'Q' then ptot1 = 10
  302.  when h1.1 = 'J' then ptot1 = 10
  303.  otherwise ptot1 = h1.1
  304.  end
  305.  select
  306.  when h1.2 = 'A' then ptot2 = 11
  307.  when h1.2 = 'K' then ptot2 = 10
  308.  when h1.2 = 'Q' then ptot2 = 10
  309.  when h1.2 = 'J' then ptot2 = 10
  310.  otherwise ptot2 = h1.2
  311.  end
  312.  call pressreturn
  313.  say ''cr
  314.  call SPLIT1
  315.  
  316. SPLIT1:
  317.  
  318.  if chicgame ~=1 then call header
  319.  say ''cr
  320.  say'   Amount bet > $'abet' per hand.    Your available cash > $'avc''cr
  321.  say ''cr
  322.  say' 'bak6'Your Hand # 1 >'def' 'pen6''h1.1' 'h1.3' 'h1.4' 'h1.5' 'h1.6' 'h1.7' 'h1.8''def''cr
  323.  say ''cr
  324.  if busted1 = 1 then isitbusted = ''pen3'BUSTED!'def''
  325.  if busted1 = 0 then isitbusted = ''
  326.  say' 'bak6'Your Total # 1 >'def' 'pen6''ptot1'  'isitbusted''cr
  327.  say ''cr
  328.  say' 'bak5'Your Hand # 2 >'def' 'pen5''h1.2' 'h2.2' 'h2.3' 'h2.4' 'h2.5' 'h2.6' 'h2.7' 'h2.8''def''cr
  329.  say ''cr
  330.  say' 'bak5'Your Total # 2 >'def' 'pen5''ptot2''def''cr
  331.  say ''cr
  332.  say' 'bak2'Dealers Hand >'def''pen2' # 'd.2' 'd.3' 'd.4' 'd.5' 'd.6' 'd.7' 'd.8''def''cr
  333.  say ''cr
  334.  if busted1 = 1 then h1done = 1
  335.  if h1done = 0 then hnum = ''pen6'Hand # 1'def''
  336.  if h1done = 1 then hnum = ''pen5'Hand # 2'def''
  337.  say' 'bak2'Dealers total >'def''pen2' ?'def'      'bak4'Currently playing'def' 'hnum''cr
  338.  say ''cr
  339.   say '             1.Draw a card    (Dealer must stand on 17, hit on 16)'cr
  340.   say '             2.Stand'cr
  341.   say ''cr
  342.   if chicgame = 1 then quitopt = ''
  343.   else quitopt = '(Q = Quit)'
  344.   prompt( ' Your choice ? 'quitopt' > ')
  345.  
  346.   ans=readstr()
  347.    if h1done = 0 then whatcard = h1
  348.    if h1done = 1 then whatcard = h2
  349.    select
  350.      when ans = 'Q' then do
  351.       if chicgame = 1 then call SPLIT1
  352.       else call QUIT
  353.       end
  354.      when ans = 1 then call DRAW whatcard splh
  355.      when ans = 2 then call STAND whatcard splh
  356.      otherwise call SPLIT1
  357.      end
  358.  
  359. BLACKJACK:
  360.  call delay(175)
  361.  call sac70''bak4'BLACKJACK !'def''
  362.  say ''cr
  363.  call sac70''bak4'BLACKJACK !'def''
  364.  say ''cr
  365.  call sac70''bak4'BLACKJACK !'def''
  366.  say ''cr
  367.  call sac70''bak4'BLACKJACK !'def''
  368.  say ''cr
  369.  call sac70''pen3'You win double your bet!'def''
  370.  say ''cr
  371.  amwon = abet*2
  372.  call sac70'$'amwon''
  373.  avc = amwon + abet  + avc
  374.  amwon = 0
  375.  if chicgame = 1 then call chicquit
  376.  else call PLAY
  377.  
  378.  
  379. STAND:
  380. arg whatcard splh
  381. if whatcard = h1 & splh = 0 then do
  382.   say ''cr
  383.   call sac70'OK, you''ll stand on 'ptot1''
  384.   say ''cr
  385.   call sac70'Now it''s the Dealers turn'
  386.   say''cr
  387.   call delay(75)
  388.   call dlrturn
  389.  end
  390.  
  391. if whatcard = h1 & splh = 1 then do
  392.   say ''cr
  393.   call sac70''def'OK, you''ll stand on 'ptot1''def''
  394.   say ''cr
  395.   call sac70'Now it''s time to play 'pen5'Hand # 2'def''
  396.   say''cr
  397.   call delay(75)
  398.   h1done = 1
  399.   call SPLIT1
  400.  end
  401.  
  402. if whatcard = h2 & splh = 1 then do
  403.   say ''cr
  404.   call sac70'OK, you''ll stand on 'ptot2''
  405.   say ''cr
  406.   call sac70'Now it''s the Dealers turn.'
  407.   say''cr
  408.   call delay(75)
  409.   call dlrturnspl
  410.  end
  411.  
  412. dlrturn:
  413.  say ''cr
  414.   select
  415.    when d.1 = A then pre = 'an'
  416.    when d.1 = 8 then pre = 'an'
  417.    otherwise pre = 'a'
  418.    end
  419.    call sac70'The Dealer turns over his hole card to reveal 'pre' 'd.1''
  420.    say '' cr
  421.    say'             'bak2'The Dealers cards :'def''pen2' 'd.1' 'd.2' 'd.3' 'd.4' 'd.5' 'd.6' 'd.7' 'd.8''def''cr
  422.    call cptot d
  423.    say'             'bak2'The Dealers total :'def''pen2' 'dtot''def'   'bak6'Your total'def' 'pen6''ptot1''def''cr
  424.    say ''cr
  425.    call pressreturn
  426.    if dtot < 22 & dtot > ptot1 & dtot > 16 then call loser
  427.    if dtot < 17 then do
  428.     do until dtot > 16
  429.      call getcard
  430.      if dc = 2 then d.3 = RCD
  431.      if dc = 3 then d.4 = RCD
  432.      if dc = 4 then d.5 = RCD
  433.      if dc = 5 then d.6 = RCD
  434.      dc = dc +1
  435.      say ''cr
  436.      select
  437.       when rcd = A then pre = 'an'
  438.       when rcd = 8 then pre = 'an'
  439.       otherwise pre = 'a'
  440.       end
  441.      call sac70'The Dealer draws 'pre' 'rcd''
  442.      say ''cr
  443.      say'             'bak2'The Dealers cards :'def''pen2' 'd.1' 'd.2' 'd.3' 'd.4' 'd.5' 'd.6' 'd.7' 'd.8''def''cr
  444.      call cptot d
  445.      say'             'bak2'The Dealers total :'def''pen2' 'dtot''def'   'bak6'Your total:'def' 'pen6''ptot1''def''cr
  446.      say ''cr
  447.       call pressreturn
  448.      if dtot > 21 then do
  449.       say ''cr
  450.        say'                        The Dealer has 'pen3'BUSTED !'def''cr
  451.       say ''cr
  452.       call winner
  453.      end
  454.     end
  455.    end
  456.    if dtot < ptot1 then call winner
  457.    if dtot = ptot1 then call push
  458.    if dtot < 22 & dtot > ptot1 & dtot > 16 then call loser
  459.  
  460. DLRTURNSPL:
  461.  say ''cr
  462.   select
  463.    when d.1 = A then pre = 'an'
  464.    when d.1 = 8 then pre = 'an'
  465.    otherwise pre = 'a'
  466.    end
  467.    call sac70'The Dealer turns over his hole card to reveal 'pre' 'd.1''
  468.    say '' cr
  469.    say'             'bak2'The Dealers cards :'def''pen2' 'd.1' 'd.2' 'd.3' 'd.4' 'd.5' 'd.6' 'd.7' 'd.8''def''cr
  470.    call cptot d
  471.    say'             'bak2'The Dealers total :'def''pen2' 'dtot''def''cr
  472.    say''cr
  473.    say'             'bak6'Your total Hand # 1 :'def' 'pen6''ptot1'   'bak5'Your total Hand # 2 :'def' 'pen5''ptot2''def''cr
  474.    say ''cr
  475.    call pressreturn
  476.    if dtot < 22 & dtot >  16 then call CALCSPL
  477.    if dtot < 17 then do
  478.     do until dtot > 16
  479.      call getcard
  480.      if dc = 2 then d.3 = RCD
  481.      if dc = 3 then d.4 = RCD
  482.      if dc = 4 then d.5 = RCD
  483.      if dc = 5 then d.6 = RCD
  484.      if dc = 6 then d.7 = RCD
  485.      if dc = 7 then d.8 = RCD
  486.      dc = dc +1
  487.      say ''cr
  488.      select
  489.       when rcd = A then pre = 'an'
  490.       when rcd = 8 then pre = 'an'
  491.       otherwise pre = 'a'
  492.       end
  493.      call sac70'The Dealer draws 'pre' 'rcd''
  494.      say ''cr
  495.      say'             'bak2'The Dealers cards :'def''pen2' 'd.1' 'd.2' 'd.3' 'd.4' 'd.5' 'd.6' 'd.7' 'd.8''def''cr
  496.      call cptot d
  497.      say'             'bak2'The Dealers total :'def''pen2' 'dtot''def''cr
  498.    say''cr
  499.      say'             'bak6'Your total Hand # 1 :'def' 'pen6''ptot1' 'pen3''isitbusted'   'bak5'Your total Hand # 2 :'def' 'pen5''ptot2''def''cr
  500.      say ''cr
  501.      call pressreturn
  502.      if dtot > 21 then do
  503.       dlbusted = 1
  504.       say ''cr
  505.       say'                          The Dealer has 'pen3'BUSTED!'def''cr
  506.       say ''cr
  507.       call calcspl
  508.      end
  509.     end
  510.    end
  511.    call calcspl
  512.  
  513. CALCSPL:  /* Calculate split wins. */
  514.     if dlbusted = 1 then do
  515.      if bj1 = 0 then do
  516.       if busted1 = 0 then do
  517.        say'                        'pen6'Your Hand # 1 is a winner!'def''cr
  518.        say'                            'pen6'Hand # 1 pays $'abet''def''cr
  519.        say ''cr
  520.        avc = abet + abet + avc
  521.        end
  522.       else do
  523.        say'                        'pen6'Your Hand # 1 is 'pen3'BUSTED.'def''cr
  524.        say'                           'pen6'Hand # 1 'pen3'loses 'pen6'$'abet''def''cr
  525.        say ''cr
  526.        end
  527.       end
  528.      else do
  529.         say'                       'pen6'Your Hand # 1 is a 'def''bak6'BLACKJACK!'def''cr
  530.         say'                           'pen6'Hand # 1 pays 'def''bak6'2 'def''pen6'times your bet!'def''cr
  531.         bjwin = abet * 2
  532.         call sac70'$'bjwin''
  533.         avc = avc + abet + bjwin
  534.         bjwin = 0
  535.         say ''cr
  536.         end
  537.  
  538.      if bj2 = 0 then do
  539.       if busted2 = 0 then do
  540.        say'                        'pen5'Your Hand # 2 is a 'def''bak5'winner!'def''cr
  541.        say'                            'pen5'Hand # 2 pays 'def''bak5'$'abet''def''cr
  542.        say ''cr
  543.        avc = abet + abet + avc
  544.        end
  545.       else do
  546.        say'                        'def''pen5'Your Hand # 2 is 'pen3'BUSTED.'def''cr
  547.        say'                                'pen5'Hand # 2 'pen3'loses 'pen5'$'abet''def''cr
  548.        say ''cr
  549.        end
  550.       end
  551.      else do
  552.        say'                        'pen5'Your Hand # 2 is a 'def''bak5'BLACKJACK!'def''def''cr
  553.        say'                            'pen5'Hand # 2 pays 'def''bak5'2 'def''pen5'times your bet!'def''cr
  554.         bjwin = abet * 2
  555.         call sac70'$'bjwin''
  556.         avc = avc + abet + bjwin
  557.         bjwin = 0
  558.         say ''cr
  559.         end
  560.        if chicgame = 1 then call chicquit
  561.        else call play
  562.       end
  563.     if dtot > ptot1 & dlbusted = 0 then do
  564.        say'                        'pen6'Your Hand # 1 is a 'pen3'loser!'def''cr
  565.        say'                            'pen6'Hand # 1 'pen3'loses 'pen6'$'abet''def''cr
  566.      say ''cr
  567.     end
  568.     if dtot < ptot1 & busted1 = 0 & bj1 = 0 then do
  569.        say'                        'pen6'Your Hand # 1 is a winner!'def''cr
  570.        say'                            'pen6'Hand # 1 wins $'abet''def''cr
  571.      say ''cr
  572.      avc = avc + (abet * 2)
  573.     end
  574.     if bj1 = 1 then do
  575.        say'                        'pen6'Your Hand # 1 is a 'def''bak4'BLACKJACK!'def''cr
  576.        say'                            'pen6'Hand # 1 wins 2 times your bet!'def''cr
  577.      bjwin = abet * 2
  578.      call sac70'$'bjwin''
  579.      say ''cr
  580.      avc = avc + abet + bjwin
  581.      bj1 = 0
  582.      bjwin = 0
  583.      end
  584.     if dtot = ptot1 & busted1 = 0 then do /* Means this is a push. */
  585.        say'                    Your Hand # 1 is a push!'cr
  586.        say'              Your bet will be returned for Hand # 1.'cr
  587.      say ''cr
  588.      avc = avc + abet
  589.     end
  590.     if busted1 = 1 then do
  591.        say'                        'pen6'Your Hand # 1 is 'pen3'BUSTED!'def''cr
  592.        say'                            'pen6'Hand # 1 'pen3'loses $'abet'!'def''cr
  593.      say ''cr
  594.      end
  595.     if dtot > ptot2 & dlbusted = 0 then do
  596.        say'                        'pen5'Your Hand # 2 is a 'pen3'loser!'def''cr
  597.        say'                            'pen5'Hand # 2 loses 'pen3'$'abet''def''cr
  598.      say ''cr
  599.     end
  600.     if dtot < ptot2 & busted2 = 0 then do
  601.        say'                        'pen5'Your Hand # 2 is a winner!'def''cr
  602.        say'                            'pen5'Hand # 2 wins $'abet''def''cr
  603.      say ''cr
  604.      avc = avc + (abet * 2)
  605.     end
  606.     if bj2 = 1 then do
  607.        say'                        'pen5'Your Hand # 2 is a 'def''bak2'BLACKJACK!'def''cr
  608.        say'                            'pen5'Hand # 2 wins 2 times your bet!'def''cr
  609.      bjwin = abet * 2
  610.      call sac70'$'bjwin''
  611.      say ''cr
  612.      avc = avc + abet + bjwin
  613.      bj2 = 0
  614.      bjwin = 0
  615.      end
  616.     if dtot = ptot2 then do /* Means this is a push */
  617.        say'                         'pen5'Your Hand # 2 is a push!'def''cr
  618.        say'                 'pen5'Your bet will be returned for Hand # 2.'def''cr
  619.      say ''cr
  620.      avc = avc + abet
  621.     end
  622.     if busted2 = 1 then do
  623.        say'                        'pen5'Your Hand # 2 is 'pen3'BUSTED!'def''cr
  624.        say'                           'pen5'Hand # 2 'pen3'loses $'abet'!'def''cr
  625.      say ''cr
  626.      end
  627.  
  628. if chicgame = 1 then call chicquit
  629. else call play
  630.  
  631. WINNER:
  632.  say ''cr
  633.  say'                   'bak2'Congratulations, you win this hand!'def''cr
  634.  
  635.    avc = (abet * 2) + avc
  636.    say ''cr
  637.    say'                          'pen2'You have just won $'abet'!'def''cr
  638.    say''cr
  639.    say ''cr
  640.  if chicgame = 1 then call chicquit
  641.  else call PLAY
  642.  
  643. LOSER:
  644.  say ''cr
  645.  say'                        'bak3'Bummer!'def''pen3' You lose this hand.'def''cr
  646.  say ''cr
  647.  say'                             'def''pen3'You just lost $'abet'!'def''def''cr
  648.  if chicgame = 1 then call chicquit
  649.  else call PLAY
  650.  
  651. PUSH:
  652.  say ''cr
  653.  call sac70'You and the Dealer tie!'
  654.  say ''cr
  655.  call sac70'You don''t win, you don''t lose.'
  656.  say ''cr
  657.  call sac70'Your bet is returned!'
  658.  avc = abet + avc
  659.  if chicgame = 1 then call chicquit
  660.  else call PLAY
  661.  
  662.  
  663. DRAW:
  664. arg whatcard splh
  665. call getcard
  666. if whatcard = h1 & splh = 0 then do
  667.   if cc = 2 then h1.3 = rcd
  668.   if cc = 3 then h1.4 = rcd
  669.   if cc = 4 then h1.5 = rcd
  670.   if cc = 5 then h1.6 = rcd
  671.   if cc = 6 then h1.7 = rcd
  672.   if cc = 7 then h1.8 = rcd
  673.   cc = cc + 1
  674.   say ''cr
  675.   call sac70'You draw a card and get'
  676.   call delay(100)
  677.   say ''cr
  678.     select
  679.    when rcd = A then pre = 'an'
  680.    when rcd = 8 then pre = 'an'
  681.    otherwise pre = 'a'
  682.    end
  683.   call sac70''pre' 'rcd''
  684.   say ''cr
  685.   call delay(100)
  686. call cptot h1 splh
  687. call chk21 h1 splh
  688. if twone = 1 then call dlrturn  /* if total is 21 Dealers turn */
  689. call chkbust h1 splh
  690. if busted = 1 then do
  691.  if chicgame = 1 then call chicquit
  692.  else call Play
  693.  end
  694. call play2
  695. end
  696.  
  697.  
  698. if whatcard = h1 & splh = 1 then do
  699.   if cch1 = 1 then h1.3 = rcd
  700.   if cch1 = 2 then h1.4 = rcd
  701.   if cch1 = 3 then h1.5 = rcd
  702.   if cch1 = 4 then h1.6 = rcd
  703.   if cch1 = 5 then h1.7 = rcd
  704.   if cch1 = 6 then h1.8 = rcd
  705.   cch1 = cch1 + 1
  706.   say ''cr
  707.   call sac70'You draw a card and get'
  708.   call delay(100)
  709.   say ''cr
  710.   select
  711.    when rcd = A then pre = 'an'
  712.    when rcd = 8 then pre = 'an'
  713.    otherwise pre = 'a'
  714.    end
  715.   call sac70''pre' 'rcd''
  716.   say ''cr
  717.   call delay(100)
  718. call cptot h1 splh
  719. call chk21 h1 splh
  720. if twone1 = 1 then do
  721.  h1done = 1
  722.  call SPLIT1
  723.  end
  724. call chkbust h1 splh
  725. if busted1 = 1 then do
  726.  h1done = 1
  727.  call SPLIT1
  728.  end
  729. call split1
  730. end
  731.  
  732. if whatcard = h2 & splh = 1 then do
  733.   if cch2 = 1 then h2.2 = rcd
  734.   if cch2 = 2 then h2.3 = rcd
  735.   if cch2 = 3 then h2.4 = rcd
  736.   if cch2 = 4 then h2.5 = rcd
  737.   if cch2 = 5 then h2.6 = rcd
  738.   if cch2 = 6 then h2.7 = rcd
  739.   cch2 = cch2 + 1
  740.   say ''cr
  741.   call sac70'You draw a card and get'
  742.   call delay(100)
  743.   say ''cr
  744.   select
  745.    when rcd = A then pre = 'an'
  746.    when rcd = 8 then pre = 'an'
  747.    otherwise pre = 'a'
  748.    end
  749.   call sac70''pre' 'rcd''
  750.   say ''cr
  751.   call delay(100)
  752. call cptot h2 splh
  753. call chk21 h2 splh
  754. if twone2 = 1 then do
  755.  call dlrturnspl
  756.  end
  757. call chkbust h2 splh
  758. if busted2 = 1 then do
  759.  if busted1 = 1 then do
  760.   say ''cr
  761.   call sac70'Both of your Hands are 'pen3'Busted!'def''
  762.   call sac70'You lose your entire wager, 'pen3'$'totwager'!'def''
  763.   if chicgame = 1 then call chicquit
  764.   else call PLAY
  765.   end
  766.  else call dlrturnspl
  767.  end
  768. call split1
  769. end
  770.  
  771.  
  772. chkbust:
  773. arg whatcard splh
  774. select
  775.   when whatcard = h1 & splh = 0 then do
  776.    if ptot1 > 21 then do
  777.     say ''cr
  778.     say'                              Your total is 'ptot1''cr
  779.     say ''cr
  780.     say'                                  'pen3'BUSTED!'def''cr
  781.     say ''cr
  782.     say'                              You just lost 'pen3'$'abet''def''cr
  783.     busted = 1
  784.     say ''cr
  785.     call pressreturn
  786.     say ''cr
  787.    end
  788.   end
  789.  
  790. when whatcard = h1 & splh = 1 then do
  791.    if ptot1 > 21 then do
  792.     say ''cr
  793.     say'                                 Your total is 'ptot1''cr
  794.     say ''cr
  795.     say'                                   'pen3'BUSTED!'def''cr
  796.     busted1 = 1
  797.     say ''cr
  798.     call sac70'Now let''s play Hand # 2'
  799.     say ''cr
  800.     call pressreturn
  801.     say ''cr
  802.    end
  803.   end
  804.  
  805.   when whatcard = h2 & splh = 1 then do
  806.    if ptot2 > 21 then do
  807.     say ''cr
  808.     say'                                 Your total is 'ptot2''cr
  809.     say ''cr
  810.     say'                                   'pen3'BUSTED!'def''cr
  811.     busted2 = 1
  812.     say ''cr
  813.     call pressreturn
  814.     say ''cr
  815.    end
  816.   end
  817. END
  818. return
  819.  
  820.  
  821. chk21:
  822. arg whatcard splh
  823.   if whatcard = h1 & splh = 0 then do
  824.    if ptot1 = 21 then do
  825.     say ''cr
  826.     call sac70'Your total is 21!'
  827.     say ''cr
  828.     call sac70'Now it''s the Dealers turn.'
  829.     twone = 1
  830.    end
  831.   end
  832.  
  833.   if whatcard = h1 & splh = 1 then do
  834.    if ptot1 = 21 then do
  835.     say ''cr
  836.     call sac70'Your total is 21!'
  837.     say ''cr
  838.     call sac70'Now let''s play Hand # 2.'
  839.     call delay(75)
  840.     twone1 = 1
  841.    end
  842.   end
  843.  
  844.   if whatcard = h2 & splh = 1 then do
  845.    if ptot2 = 21 then do
  846.     say ''cr
  847.     call sac70'Your total is 21!'
  848.     say ''cr
  849.     call sac70'Now let''s see what kinda luck the Dealer has.'
  850.     twone2 = 1
  851.    end
  852.   end
  853.  
  854. return
  855.  
  856. CHECKDD:
  857.  
  858.    if h1.1 = '10' then Return
  859.    if h1.1 = 'J' then Return
  860.    if h1.1 = 'Q' then Return
  861.    if h1.1 = 'K' then Return
  862.    if h1.1 = 'A' then Return
  863.  
  864.    if h1.2 = '10' then Return
  865.    if h1.2 = 'J' then Return
  866.    if h1.2 = 'Q' then Return
  867.    if h1.2 = 'K' then Return
  868.    if h1.2 = 'A' then Return
  869.  
  870.    if cc = 2 & h1.1 + h1.2 > 9 & h1.1 + h1.2 < 12 then do
  871.     if abet > avc then do
  872.      say '    You don''t have enough cash to Double Down.'cr
  873.      return
  874.      end
  875.     if splm = 1 then say '             4.Double Down'cr
  876.     else say '             3.Double Down'cr
  877.     ddnm = 1  /* This says display Double Down menu */
  878.    end
  879.  
  880. Return
  881.  
  882. CPTOT:
  883.  
  884. arg whatcard splh
  885. acecount = 0
  886.   if whatcard = h1 & splh = 0 then do
  887.      do i = 1 to 8
  888.       if h1.i = '' then t.i = 0
  889.       if h1.i = 'J' then t.i = 10
  890.       if h1.i = 'Q' then t.i = 10
  891.       if h1.i = 'K' then t.i = 10
  892.       if h1.i = 'A' then do
  893.        acecount = acecount + 1
  894.        t.i = 0
  895.        end
  896.       if h1.i > 1 & h1.i < 11 then t.i = h1.i
  897.       end
  898.       tptot = t.1 + t.2 + t.3 + t.4 + t.5 + t.6 + t.7 + t.8   /* temp point total*/
  899.       if acecount = 1 then do
  900.        if tptot < 11 then tptot = tptot + 11
  901.        else tptot = tptot + 1
  902.        end
  903.       if acecount = 2 then do
  904.        if tptot < 10 then tptot = tptot + 12
  905.        else tptot = tptot + 2
  906.        end
  907.       if acecount = 3 then do
  908.        if tptot < 9 then tptot = tptot + 13
  909.        else tptot = tptot + 3
  910.        end
  911.       if acecount = 4 then do
  912.        if tptot < 8 then tptot = tptot + 14
  913.        else tptot = tptot + 4
  914.        end
  915.       ptot1 = tptot
  916.       acecount = 0
  917.       tptot = 0
  918.      end
  919.   if whatcard = d then do
  920.      do i = 1 to 8
  921.       if d.i = '' then t.i = 0
  922.       if d.i = 'J' then t.i = 10
  923.       if d.i = 'Q' then t.i = 10
  924.       if d.i = 'K' then t.i = 10
  925.       if d.i = 'A' then do
  926.        acecount = acecount + 1
  927.        t.i = 0
  928.        end
  929.       if d.i > 1 & d.i < 11 then t.i = d.i
  930.       end
  931.       tptot = t.1 + t.2 + t.3 + t.4 + t.5 + t.6 + t.7 + t.8   /* temp point total*/
  932.       if acecount = 1 then do
  933.        if tptot < 11 then tptot = tptot + 11
  934.        else tptot = tptot + 1
  935.        end
  936.       if acecount = 2 then do
  937.        if tptot < 10 then tptot = tptot + 12
  938.        else tptot = tptot + 2
  939.        end
  940.       if acecount = 3 then do
  941.        if tptot < 9 then tptot = tptot + 13
  942.        else tptot = tptot + 3
  943.        end
  944.       if acecount = 4 then do
  945.        if tptot < 8 then tptot = tptot + 14
  946.        else tptot = tptot + 4
  947.        end
  948.       dtot = tptot
  949.       acecount = 0
  950.       tptot = 0
  951.      end
  952.  
  953.   if whatcard = h1 & splh = 1 then do
  954.      do i = 1 to 8
  955.       if h1.i = '' then t.i = 0
  956.       if h1.i = 'J' then t.i = 10
  957.       if h1.i = 'Q' then t.i = 10
  958.       if h1.i = 'K' then t.i = 10
  959.       if h1.i = 'A' then do
  960.        acecount = acecount + 1
  961.        t.i = 0
  962.        end
  963.       if h1.i > 1 & h1.i < 11 then t.i = h1.i
  964.       end
  965.       tptot = t.1 + t.3 + t.4 + t.5 + t.6 + t.7 + t.8   /* temp point total*/
  966.       if h1.2 = 'A' then acecount = acecount - 1
  967.       if acecount = 1 then do
  968.        if tptot < 11 then tptot = tptot + 11
  969.        else tptot = tptot + 1
  970.        end
  971.       if acecount = 2 then do
  972.        if tptot < 10 then tptot = tptot + 12
  973.        else tptot = tptot + 2
  974.        end
  975.       if acecount = 3 then do
  976.        if tptot < 9 then tptot = tptot + 13
  977.        else tptot = tptot + 3
  978.        end
  979.       if acecount = 4 then do
  980.        if tptot < 8 then tptot = tptot + 14
  981.        else tptot = tptot + 4
  982.        end
  983.       ptot1 = tptot
  984.       acecount = 0
  985.       tptot = 0
  986.      end
  987.  
  988.   if whatcard = h2 & splh = 1 then do
  989.      do i = 1 to 8
  990.       if h2.i = '' then t.i = 0
  991.       if h2.i = 'J' then t.i = 10
  992.       if h2.i = 'Q' then t.i = 10
  993.       if h2.i = 'K' then t.i = 10
  994.       if h2.i = 'A' then do
  995.        acecount = acecount + 1
  996.        t.i = 0
  997.        end
  998.       if h2.i > 1 & h2.i < 11 then t.i = h2.i
  999.       end
  1000.       tptot = t.2 + t.3 + t.4 + t.5 + t.6 + t.7 + t.8   /* temp point total*/
  1001.       if h1.2 > 1 & h1.2 < 11 then tptot = tptot + h1.2
  1002.       if h1.2 = 'J' then tptot = tptot + 10
  1003.       if h1.2 = 'Q' then tptot = tptot + 10
  1004.       if h1.2 = 'K' then tptot = tptot + 10
  1005.       if h1.2 = 'A' then do
  1006.        if tptot < 11 then tptot = tptot + 11
  1007.        else tptot = tptot + 1
  1008.        end
  1009.       if acecount = 1 then do
  1010.        if tptot < 11 then tptot = tptot + 11
  1011.        else tptot = tptot + 1
  1012.        end
  1013.       if acecount = 2 then do
  1014.        if tptot < 10 then tptot = tptot + 12
  1015.        else tptot = tptot + 2
  1016.        end
  1017.       if acecount = 3 then do
  1018.        if tptot < 9 then tptot = tptot + 13
  1019.        else tptot = tptot + 3
  1020.        end
  1021.       if acecount = 4 then do
  1022.        if tptot < 8 then tptot = tptot + 14
  1023.        else tptot = tptot + 4
  1024.        end
  1025.       ptot2 = tptot
  1026.       acecount = 0
  1027.       tptot = 0
  1028.      end
  1029.  
  1030. Return
  1031.  
  1032. getcard:
  1033.    RND = RANDOM(1,13)
  1034.     if RND > 1 & RND < 11 then do
  1035.       RCD = RND
  1036.       end
  1037.     if RND = 1 then RCD = 'A'
  1038.     if RND = 11 then RCD = 'J'
  1039.     if RND = 12 then RCD = 'Q'
  1040.     if RND = 13 then RCD = 'K'
  1041. Return
  1042.  
  1043.  
  1044. bet:
  1045.    say ''cr
  1046.    say ''cr
  1047.    say ' You have $'avc' available'cr
  1048.    say ''cr
  1049.    prompt( '  How much would you like to bet? 'pen3'$500 max. 'def'(Q = Quit) > $')
  1050.    abet=readstr()
  1051.    abet = strip(abet)
  1052.    if abet = 'Q' then do
  1053.     if chicgame = 1 then do
  1054.      say ''cr
  1055.      say'  Sorry Bud, you can''t sit down and then refuse to bet!'cr
  1056.      say'  Now bet something! Or should I get some muscle over here?'cr
  1057.      say ''cr
  1058.      say ''cr
  1059.      call bet
  1060.      end
  1061.     else call quit
  1062.    end
  1063.    if abet = ''| abet = 0 then do
  1064.     say''cr
  1065.     say'    OK Buddy, if your not going to bet,'cr
  1066.     say'    we''re going to have to ask you to'cr
  1067.     say'    leave so we can seat another player!'cr
  1068.     call bet
  1069.    end
  1070.    if datatype(abet,W) ~= 1 then do
  1071.     say ''cr
  1072.     say '   The Dealer glares at you and says'cr
  1073.     say '   "We have rules at this table Buddy!'cr
  1074.     say '   You can only bet 'pen3'WHOLE'def' dollars'cr
  1075.     say '   and Your ABC''s aren''t worth anything here!"'cr
  1076.     say ''cr
  1077.     abet = ''
  1078.     call BET
  1079.     end
  1080.    if abet > 500 then do
  1081.     say ''cr
  1082.     say' Sorry pal, there''s a $500 limit at this table!'cr
  1083.     say' How ''bout betting a little less...'cr
  1084.     abet = ''
  1085.     call bet
  1086.     end
  1087.    if abet > avc then do
  1088.      say' Sorry, You can''t bet more than you have!'cr
  1089.      say' We do not extend credit at this establishment!'cr
  1090.      say' Please try again.'cr
  1091.      abet = ''
  1092.      call BET
  1093.      end
  1094.  
  1095.  
  1096.    if abet = '' then call bet
  1097.    say ''cr
  1098.    call delay(25)
  1099. Return
  1100.  
  1101. QUIT:
  1102.   say ''cr
  1103.   say'  Thanks for playing BlackJack! Come back soon!'cr
  1104.   say'  Returning now to the BBS.....'cr
  1105.   exit
  1106.  
  1107. chicquit:
  1108.   call setclip('CHICMON',avc)
  1109.   say ''cr
  1110.   say ''cr
  1111.   say' Thanks for trying BlackJack, come back any time (that ya got cash).'cr
  1112.   say ''cr
  1113.   exit
  1114.  
  1115. SAC70:  /* SAY CENTER TEXT*/
  1116. PARSE ARG string
  1117. SAY CENTER(string,75)||CR
  1118. RETURN
  1119.  
  1120. SAC110:  /* SAY CENTER TEXT*/
  1121. PARSE ARG string
  1122. SAY CENTER(string,110)||CR
  1123. RETURN
  1124.  
  1125. HEADER:
  1126. say'          'pen3'----------------------------------------------------------'cr
  1127. say'          'pen3'| 'pen5'BlackJack'pen6'BlackJack'pen5'BlackJack'pen6'BlackJack'pen5'BlackJack'pen6'BlackJack 'pen3'|'cr
  1128. say'          'pen3'| 'pen6'Jack'pen5'BlackJack'pen6'BlackJack'pen5'BlackJack'pen6'BlackJack'pen5'BlackJack'pen6'Black 'pen3'|'cr
  1129. say'          'pen3'----------------------------------------------------------'def''cr
  1130. return
  1131.  
  1132. pressreturn:
  1133. SAY' 'pen3' Press return to continue'def''
  1134. out=readch(STDIN)
  1135. return
  1136.  
  1137. readstr: procedure
  1138. str=''
  1139. out=readch(STDIN)
  1140.  call WRITECH(STDOUT,out)
  1141.  do while out~=D2C(13)
  1142.       if out=D2C(8) then do
  1143.          str=SUBSTR(str,1,LENGTH(str)-1)
  1144.          call WRITECH(STDOUT,' ')
  1145.          call WRITECH(STDOUT,out)
  1146.          end
  1147.       else
  1148.          str=INSERT(str,out)
  1149.       out=readch(STDIN)
  1150.       call WRITECH(STDOUT,out)
  1151.     end
  1152. say '0D'x
  1153. return(UPPER(str))
  1154.  
  1155. prompt: procedure
  1156. parse arg str
  1157. writech(STDOUT,str)
  1158. return 1
  1159.  
  1160. SYNTAX:
  1161.    SAY '*BOOM*  Got a syntax error.  PLEASE notify the sysop.'
  1162.    SAY 'Line:' SIGL '   Error Code:' RC
  1163. exit
  1164.  
  1165.  
  1166. checkBBS:
  1167. IF ADDRESS()~='BAUD' THEN RETURN 0
  1168. IF TIME('e')>secs THEN SIGNAL QUIT
  1169. dcd
  1170. IF RC=0 THEN EXIT
  1171. temp=secs-TIME('E')
  1172. IF temp<120 THEN SAY '*** Only' temp 'seconds left! ***'CR 
  1173. RETURN 0
  1174.  
  1175.  
  1176. BREAK_C:
  1177. BREAK_E:
  1178. say'BREAK * BREAK * BREAK *'cr
  1179. say''cr
  1180. if chicgame = 1 then call chicquit
  1181. call quit
  1182. exit
  1183.